<?php

  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $LicensesUid = str_replace ( '"', '', $aux[0] );

  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrLicenses.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrLicensesPeer::retrieveByPK( $LicensesUid  );

  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrLicenses' ) ) { 
     $fields['LICENSES_UID'] = $tr->getLicensesUid();
     $fields['EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['LICENSEDESCRIPTION'] = $tr->getLicensedescription();
     $fields['LICENSEISSUEDATE'] = $tr->getLicenseissuedate();
     $fields['LICENSEEXPIRATIONDATE'] = $tr->getLicenseexpirationdate();
     $fields['LICENSERENEWALDATE'] = $tr->getLicenserenewaldate();
     $fields['LICENSENUMBER'] = $tr->getLicensenumber();
     $fields['LICENSETYPE_ID'] = $tr->getLicensetypeId();
  }
  else
    $fields = array();

  $G_MAIN_MENU = 'workflow';
  $G_SUB_MENU = 'hrLicenses';
  $G_ID_MENU_SELECTED = '';
  $G_ID_SUB_MENU_SELECTED = '';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrLicensesEdit', '', $fields, 'hrLicensesSave' );
  G::RenderPage('publish', 'blank');
?>